package com.jiaai.web.member;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.auth.model.AccessUser;
import com.jiaai.exception.ServerException;
import com.jiaai.member.api.IAccusationAPI;
import com.jiaai.member.model.BAccusation;

import com.jiaai.util.ConstantUtils;
import com.jiaai.util.RestResultGenerator;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * TODO
 * </p>
 *
 * @author 佳爱网络科技
 * @version V1.0
 * @title AccusationController
 * @since 2017/11/13
 */
@RequestMapping("/api/v1/accusation")
@RestController
public class AccusationController {

    @Reference
    private IAccusationAPI accusationAPI;

    /**
     *举报主播
     * @param accessUser
     * @param accusation
     * @return
     * @throws ServerException
     */
    @GetMapping("/add")
    public  Object add(
                @SessionAttribute(ConstantUtils.ACCESS_USER) AccessUser accessUser,
                BAccusation accusation)throws ServerException{
         accusation.setmId(accessUser.getUserId());
         accusationAPI.add(accusation);
         return RestResultGenerator.genSuccessResult("ok");
    }
}
